<?php
namespace App\Admin\Controllers;
use App\Admin\Models\Feedbacks;
use App\Admin\Models\Member;
use Common\ControllerAdBase;
use Phalcon\Paginator\Adapter\Model as PaginatorModel;

class OtherController extends ControllerAdBase
{

    public function initialize()
    {
        parent::initialize();
    }


    /**
     * 意见反馈
     */
    public function feedbacksAction(){
        //当前页数
        if (!isset($this->params['page']) || empty($this->params['page'])) {
            $this->params['page'] = 1;
        }
        //当前条数
        if (!isset($this->params['limit']) || empty($this->params['limit'])) {
            $this->params['limit'] = 10;
        }
        $feedbacksDb = new Feedbacks();
        $getlist['list']=$feedbacksDb->get_list($this->params);
        $member = new Member();
        foreach($getlist['list'] as $key=>$value){
            $user_find_one = $member->findFirstById($value['user_id']);
            $getlist['list'][$key]['phone'] = $user_find_one ? $user_find_one->phone : '';
        }
        $getlist['total']=$feedbacksDb->get_list($this->params,'count');
        $this->ok($getlist);
    }
}
